package logic

import (
	"context"
	"goods/goodsrpc/goodsrpcclient"

	"goods/api/internal/svc"
	"goods/api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type CommentShowLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewCommentShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CommentShowLogic {
	return &CommentShowLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *CommentShowLogic) CommentShow(req *types.CommentShowRequest) (resp *types.Response, err error) {
	// todo: add your logic here and delete this line

	comment, err := l.svcCtx.GoodsRpc.CommentShow(l.ctx, &goodsrpcclient.CommentShowRequest{})
	if err != nil {
		return &types.Response{
			Message: err.Error(),
			Data:    nil,
			Code:    500,
		}, nil
	}
	return &types.Response{
		Message: "评论展示成功",
		Data:    comment,
		Code:    200,
	}, nil
}
